package date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class DateTest {

	public static void main(String[] args) throws ParseException {
		//输入一个日期字符串，转换成日期对象"yyyy-MM-dd"格式
		SimpleDateFormat day = new SimpleDateFormat("yyyy-MM-dd");
		System.out.println("请输入:");
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		try {
			Date date =day.parse(ss);
			System.out.println(date);
		} catch (ParseException e) {
			System.out.println("输入格式错误！");
			e.printStackTrace();
	}

}
}